import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Sangre here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Sangre extends Actor
{
   private GreenfootImage ima1;
   private GreenfootImage ima2;
   private GreenfootImage ima3;
   private GreenfootImage ima4;
   private GreenfootImage ima5;
   private GreenfootImage ima6;
   private GreenfootImage ima7;
   private GreenfootImage ima8;
   private GreenfootImage ima9;
   private GreenfootImage ima10;
   private Ladron l;
   public Sangre(Ladron lad)
   {
       ima1=new GreenfootImage("1.png");
       ima2=new GreenfootImage("2.png");
       ima3=new GreenfootImage("3.png");
       ima4=new GreenfootImage("4.png");
       ima5=new GreenfootImage("5.png");
       ima6=new GreenfootImage("6.png");
       ima7=new GreenfootImage("7.png");
       ima8=new GreenfootImage("8.png");
       ima9=new GreenfootImage("9.png");
       ima10=new GreenfootImage("10.png");
       l=lad;
   }
   
   public void act() 
    {
        cambia();
    }    
    
    /**
     * Metodo para bajar sangre con el impacto
     */
    public void cambia()
    {
        World mundo=getWorld();
        int d = ((Mundo)mundo).dameDano();
        if(d>=0 && d <= 10)
            setImage(ima1);
        if(d>=11 && d<=19)
            setImage(ima2);
        if(d>=20 && d<=29)
            setImage(ima3);
        if(d>=30 && d<=39)
            setImage(ima4);
        if(d>=40 && d<=49)
            setImage(ima5);
        if(d>=50 && d<=59)
            setImage(ima6);
        if(d>=60 && d<=69)
            setImage(ima7);
        if(d>=70 && d<=79)
            setImage(ima8);
        if(d>=80 && d<=89)
            setImage(ima9);
        if(d>=90 && d<=100)
            setImage(ima10);
            
        setLocation(l.getX(),l.getY()-55);
    }
}
